package portal.manager.data.template;

import static org.bsc.bean.BeanManagerUtils.EMPTY_PROPERTYDESCRIPTOR;
import static org.bsc.bean.BeanManagerUtils.joinProperties;

import java.beans.PropertyDescriptor;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.bsc.bean.PropertyDescriptorField;

import portal.manager.data.TemplateVariableBeanInfo;
import portal.manager.data.Template.Variable;

public class TemplateVariableExBeanInfo extends TemplateVariableBeanInfo {

	public TemplateVariableExBeanInfo() {
		super( TemplateVariableEx.class );
	}

	
	protected TemplateVariableExBeanInfo(Class<? extends Variable> beanClass) {
		super(beanClass);
	}


	@Override
	public PropertyDescriptor[] getPropertyDescriptors() {

		try {
			return  joinProperties( super.getPropertyDescriptors(), 
	                					new PropertyDescriptorField( "description", getBeanClass(), "getDescription", "setDescription")
											.setSize(255),	
		                				new PropertyDescriptorField( "defaultValue", getBeanClass(), "getDefaultValue", "setDefaultValue")
											.setSize(255)	
					);
		} catch (Exception e) {
			Logger.global.log(Level.WARNING, "TemplateVariableEx.getPropertyDescriptor() error", e);
		}
		
		return EMPTY_PROPERTYDESCRIPTOR;
	}

}
